#  Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

# Hisilicon nnie sample makefile

# 编译所需的公共文件
include ./mk.param

# 编译后生成的可执行文件名
TARGET := ohos_yolov5_demo

# 编译此工程需要依赖的.c或.cpp文件
OPENCV_LIB_DIR = $(AI_SAMPLE_DIR)/third_party/output/opencv/lib
FFMPEG_LIB_DIR = $(YOLOV5_LITE_DIR)/ffmpeg/lib

SMP_SRCS += $(YOLOV5_LITE_DIR)/audio/audio_aac_adp.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/audio/audio_dl_adp.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/audio/audio_rtmp.c

SMP_SRCS += $(YOLOV5_LITE_DIR)/common/sample_comm_audio.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/common/sample_comm_ive.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/common/sample_comm_nnie.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/common/sample_comm_svp.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/common/sample_comm_venc.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/common/sample_ive_queue.c

SMP_SRCS += $(YOLOV5_LITE_DIR)/mpp/ive_img.c
SMP_SRCS += $(YOLOV5_LITE_DIR)/mpp/vgs_img.c

SMP_SRCS += $(YOLOV5_LITE_DIR)/rtmp/ffmpeg_rtmp.c

SMP_SRCS += $(YOLOV5_LITE_DIR)/smp/sample_lcd.c

CPP_SRCS += $(YOLOV5_LITE_DIR)/src/main_process.cpp
CPP_SRCS += $(YOLOV5_LITE_DIR)/src/svp_nnie_application.cpp
SMP_SRCS += $(YOLOV5_LITE_DIR)/src/trace.c

CPP_SRCS += $(YOLOV5_LITE_DIR)/tracking/kalman_tracking.cpp
SMP_SRCS += $(YOLOV5_LITE_DIR)/tracking/lbph_tracking.c

SMP_SRCS += $(YOLOV5_LITE_DIR)/uart/uart.c

SMP_SRCS += $(YOLOV5_LITE_DIR)/main.c

SMP_SRCS += $(PLATRORM_COMMON_DIR)/loadbmp.c
SMP_SRCS += $(PLATRORM_COMMON_DIR)/sample_comm_isp.c
SMP_SRCS += $(PLATRORM_COMMON_DIR)/sample_comm_region.c
SMP_SRCS += $(PLATRORM_COMMON_DIR)/sample_comm_sys.c
SMP_SRCS += $(PLATRORM_COMMON_DIR)/sample_comm_vi.c
SMP_SRCS += $(PLATRORM_COMMON_DIR)/sample_comm_vo.c
SMP_SRCS += $(PLATRORM_COMMON_DIR)/sample_comm_vpss.c

# 编译此工程需要包含的头文件
CFLAGS += -I$(YOLOV5_LITE_DIR)/audio
CFLAGS += -I$(YOLOV5_LITE_DIR)/common
CFLAGS += -I$(YOLOV5_LITE_DIR)/inc
CFLAGS += -I$(YOLOV5_LITE_DIR)/mpp
CFLAGS += -I$(YOLOV5_LITE_DIR)/rtmp
CFLAGS += -I$(YOLOV5_LITE_DIR)/smp
CFLAGS += -I$(YOLOV5_LITE_DIR)/tracking
CFLAGS += -I$(YOLOV5_LITE_DIR)/uart

CFLAGS += -Wno-psabi -I$(AI_SAMPLE_DIR)/third_party/output/opencv/include/opencv4

CFLAGS += -Wno-psabi -I$(YOLOV5_LITE_DIR)/ffmpeg/include

# 编译此工程需要依赖的库函数
MPI_LIBS += -L$(OPENCV_LIB_DIR)
MPI_LIBS += -lopencv_world -lpthread -lrt -ldl

MPI_LIBS += -L$(FFMPEG_LIB_DIR)
MPI_LIBS += -lavcodec -lavformat -lavutil -lswresample -lswscale

# 根据实际的类型设置，可以用set_sensor脚本设置
SENSOR0_TYPE = -DSENSOR0_TYPE=SONY_IMX335_MIPI_4M_30FPS_12BIT
SENSOR1_TYPE = -DSENSOR1_TYPE=SONY_IMX335_MIPI_4M_30FPS_12BIT
CFLAGS += $(SENSOR0_TYPE)
CFLAGS += $(SENSOR1_TYPE)

# 编译工程所需的mk文件
include ./sdk_linux.mk
